package org.freez4.spring.bean.factory;

import org.freez4.spring.ioc.overview.domain.User;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.FactoryBean;

/**
 * 通过 {@link BeanFactory} 接口创建{@link User}对象
 *
 * @author 阿坤同学
 * @date 2023/12/6 4:31 PM
 */
public class UserFactoryBean implements FactoryBean<User> {
    @Override
    public User getObject() throws Exception {
        User user = new User();
        user.setId(5);
        user.setAge(100);
        user.setName("通过FactoryBean接口创建User对象");
        return user;
    }

    @Override
    public Class<?> getObjectType() {
        return User.class;
    }
}
